﻿@model Inscriptionem.Areas.Inscriptionem.Models.Views.SettingsViewModel

@{
    ViewBag.Title = "Inscriptionem » Settings";
    Layout = "../Shared/Layout.cshtml";

    ViewBag.CurrentPage = "Settings";

    string message = string.Empty;

    switch (Model.Error)
    {
        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.MailInvalid:
            {
                message = "Please enter valid mail.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.UrlEmpty:
            {
                message = "Please enter URL.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.UrlInvalid:
            {
                message = "Please enter valid URL.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.PasswordEmpty:
            {
                message = "Please enter password.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.PasswordNotMatched:
            {
                message = "Passwords does not match.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.Other:
            {
                message = "Unknown error occurred, please try again.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.Saved:
            {
                message = "Settings saved.";
                break;
            }

        case Inscriptionem.Areas.Inscriptionem.Models.Enums.SettingsError.PageSizeInvalid:
            {
                message = "Invalid number of items on page.";
                break;
            }
    }
}

<div class="outer" id="contentwrap">
    @{Html.RenderPartial("NavigationMenu");}
    <div class="postcont">
		<div id="content">
            <div class="post type-post status-publish format-standard hentry">
                <h2 class="title">Settings</h2>
                <div class="postdate-single error-message">@message</div>
                <form method="post" action="/Inscriptionem/Settings">
                    <div class="postdate">General</div>
				    <div class="entry">
                        <p>URL <input type="text" name="URL" value="@Model.URL" /></p>
                        <p>Title <input type="text" name="Title" value="@Model.Title" /></p>
	                </div>

                    <div class="postdate">Members</div>
				    <div class="entry">
                        <p>Registration Allowed <input type="checkbox" name="RegistrationAllowed" @(Model.RegistrationAllowed ? "checked" : string.Empty) /></p>
                        <p>Registration Approval Required <input type="checkbox" name="RegistrationApprovalRequired" @(Model.RegistrationApprovalRequired ? "checked" : string.Empty) /></p>
	                </div>

                    <div class="postdate">Comments</div>
				    <div class="entry">
                        <p>Allowed <input type="checkbox" name="CommentsAllowed" @(Model.CommentsAllowed ? "checked" : string.Empty) /></p>
                        <p>Approval Required <input type="checkbox" name="CommentsPublishApprovalRequired" @(Model.CommentsPublishApprovalRequired ? "checked" : string.Empty) /></p>
	                </div>

                    <div class="postdate">Mail</div>
				    <div class="entry">
                        <p>Sender <input type="text" name="Sender" value="@Model.Sender" /></p>
                        <p>Server <input type="text" name="Server" value="@Model.Server" /></p>

                        <p>Port <input type="text" name="Port" value="@Model.Port" /></p>
                        <p>SSL <input type="checkbox" name="SSL" @(Model.SSL ? "checked" : string.Empty) /></p>

                        <p>Login <input type="text" name="Server" value="@Model.Login" /></p>
                        <p>Password <input type="password" name="Password" value="@Model.Password" /></p>
                        <p>Confirm Password <input type="password" name="PasswordConfirmation" value="@Model.PasswordConfirmation" /></p>
	                </div>

                    <div class="postdate">Blog</div>
				    <div class="entry">
                        <p>Items on page <input type="text" name="PageSize" value="@Model.PageSize" /></p>
                    </div>

                    <input type="reset" value="Reset" />&nbsp;|&nbsp;<input type="submit" value="Save" />
                </form>
			</div>
        </div>
	</div>	
</div>
